/***************************************************************************************************
  Copyright(C)   2011-9-13
  All rights reserved.
  File Name: systemexaminition.h

  Description:获取系统状态模块

  ***************************************************************************************************/

#ifndef SYSTEMEXAMINITION_H
#define SYSTEMEXAMINITION_H

#include <QtGlobal>

#ifdef Q_OS_LINUX
#include <mntent.h>
#include <sys/statfs.h>
#endif

#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <QDebug>
#include <string.h>

#include "environment.h"

typedef struct MEMSTATE{
        unsigned long totalMem;
        unsigned long freeMem;
        unsigned long buffers;
        unsigned long cached;
        unsigned long usedMem;
}MemState;


typedef struct PACKED         //定义一个mem occupy的结构体
{
char name[20];      //定义一个char类型的数组名name有20个元素
unsigned long total;
char name2[20];
unsigned long free;
}MEM_OCCUPY;

typedef struct CPUSTATE{
        unsigned int user;
        unsigned int nice;
        unsigned int system;
        unsigned int idle;
        unsigned int iowait;
        unsigned int irq;
        unsigned int softirq;
        unsigned int stealstolen;
        unsigned int guest;
}CpuState;

int getMemOccupy(MemState *mem);
//int getMemOccupy(MEM_OCCUPY *mem);

void getCpuState(CpuState *cpuState);
int getCpuOccupy();
int getDiskState(unsigned int *allSize, unsigned int *useSize);

class SystemExaminition
{
public:
    SystemExaminition();

    SystemState getSystemState() const;


};

#endif // SYSTEMEXAMINITION_H
